<?php


namespace backend\modules\tool\helpers;


use backend\modules\tool\DataSource\Log\Log;
use backend\modules\tool\models\Node;

/**
 * 进程运行的上下行文
 * Class Context
 * @package backend\modules\tool\helpers
 */
class Context
{
    protected static $obj=null;
    /**
     * @var Log $log
     */
    protected $log;
    /**
     * @var Node $node
     */
    protected $node;
    /**
     * @var \PDO $sourcePdo
     */
    protected $sourcePdo;
    /**
     * @var \PDO $descPdo
     */
    protected $descPdo;
    public static function SingleTon(){
        if(empty(self::$obj)){
            self::$obj=new self();
        }
        return self::$obj;
    }
    protected function __construct()
    {

    }

    /**
     * @param \PDO $PDO
     */
    public function setDescPdo(\PDO $PDO){
        $this->descPdo=$PDO;
    }
    public function getDescPod(){
        return $this->descPdo;
    }
    /**
     * @param \PDO $PDO
     */
    public function setSourcePdo(\PDO $PDO){
        $this->sourcePdo=$PDO;
    }
    public function getSourcePdo(){
        return $this->sourcePdo;
    }
    public function setLog(Log $log){
        $this->log=$log;
    }
    public function getLog(){
        return $this->log;
    }
    public function setNode($node){
        $this->node=$node;
    }
    public function getNode(){
        return $this->log;
    }
    public function set($key,$value){
        $this->$key=$value;
    }
    public function get($key){
        return $this->$key;
    }
    public function exist($key){
        if(property_exists($this,$key)){
            return true;
        }
        return false;
    }
}